home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_1
/
moonphas.tar
/
moonphase
< prev
next >
Wrap
Internet Message Format
|
1990-08-24
|
5KB
From fin@norge.unet.umn.edu Fri Apr 6 22:42:03 1990
From: fin@norge.unet.umn.edu (Craig A. Finseth)
Newsgroups: comp.sys.handhelds
Subject: HP-48SX Program to Calculate/Show the Phase of the Moon
Date: 2 Apr 90 21:28:12 GMT
Organization: Univ Netw Serv, Univ of Minn
In order for bugs to depend on the phase of the moon, they must first
be able to find out what the phase of the moon is. This program
should help.
Note: this program uses a first-order sin approximation. The correct
expression contains about 30 sin terms. Still, what you see displayed
corresponds reasonably well with what you see in the sky...
Written by: Craig Finseth, University of Minnesota
From: 29 Mar 1990
What: Phase of Moon Display
MPHASE Calculate and show the phase of the moon for the current date/time
MTIME Calculate and show the moon time string for the current date/time
MFRAC Calculate the moon phase fraction (0 new moon; .25 first quarter;
.5 full moon; .75 last quarter)
FLIP Invert the screen. Fast, but displays garbage during the flip.
MPLOT Internal to MPHASE: Plot the crescent
MLINE Internal to MPHASE: Draw a line of the crescent
MFINI Internal to MPHASE: display the stars, call FLIP
SLOFLIP An alternate, slow but smooth flip.
Notes:
- If you want to generalize the date/time caluclated for, change
MFRAC.
- You can omit the flip by removing the call to FLIP from MFINI.
- You can omit both the flip and the stars by removing the call to
MFINI from MPHASE.
- The base time for new moon is 12 Jan 1975 at 10:21 am GMT (4:21 AM
CST, which is the figure used in the program).
- The moon cycle is assumed to by 42,532 minutes long.
- The stars displayed are just random bits: they do not correspond to
real stars.
Checksum: #12458d
Size: 1397.5
------------------------------------------------------------
%%HP: T(3)A(D)F(.);
DIR
MPHASE
\<< RCLF -31 SF
DEG ERASE { # 0d
# 0d } PVIEW {
# 64d # 28d } # 26d
0 360 ARC 26 28
MFRAC MPLOT MFINI 7
FREEZE STOF
\>>
MTIME
\<< MFRAC \-> X
\<<
IF X .25 <
THEN "NM+"
ELSE
IF X .5 <
THEN
"FQ+"
ELSE
IF X
.75 <
THEN
"FM+"
ELSE
"LQ+"
END
END
END X
\>> .25 MOD
42532 * SWAP OVER
1440 / IP \->STR +
"d " + SWAP 1440
MOD SWAP OVER 60 /
IP \->STR + "h " +
SWAP 60 MOD SWAP
OVER IP \->STR + "m "
+ SWAP FP 60 * IP
\->STR + "s" +
\>>
MFRAC
\<< 1.121975 DATE
DDAYS TIME 4.21
HMS- HMS\-> 24 / +
1440 * 42532 / FP
\>>
FLIP
\<< PICT RCL NEG
PICT STO
\>>
MPLOT
\<< \-> RA MI F
\<<
IF F .5 <
THEN F 360
* COS RA * RA
ELSE RA NEG
F .5 - 360 * COS RA
*
END \-> L R
\<< 1 0
FOR x x
ACOS SIN DUP MI x
RA * + L R MLINE MI
x RA * - L R MLINE
RA INV NEG
STEP
\>>
\>>
\>>
MLINE
\<< \-> SC LI L R
\<< SC L * 64 +
R\->B LI R\->B 2 \->LIST
SC R * 64 + R\->B LI
R\->B 2 \->LIST LINE
\>>
\>>
MFINI
\<< { # 10d # 10d
} PIXON { # 110d
# 15d } PIXON {
# 100d # 50d }
PIXON { # 30d # 41d
} PIXON { # 31d
# 41d } PIXON FLIP
\>>
SLOFLIP
\<< 0 63
FOR l # 0d l
R\->B 2 \->LIST # 130d
l R\->B 2 \->LIST TLINE
NEXT
\>>
END
Craig A. Finseth fin@unet.umn.edu [CAF13]
University Networking Services +1 612 624 3375 desk
University of Minnesota +1 612 626 1002 FAX
130 Lind Hall, 207 Church St SE, Minneapolis MN 55455-0134, U.S.A.
From prestonb@hpcvra.CV.HP.COM Mon Apr 9 18:09:39 1990
From: prestonb@hpcvra.CV.HP.COM (Preston Brown)
Newsgroups: comp.sys.handhelds
Subject: Re: HP-48SX Program to Calculate/Show the Phase of the Moon
Date: 6 Apr 90 23:22:07 GMT
Organization: Hewlett-Packard Co., Corvallis, OR, USA
If you don't want to glitch the display then change FLIP to:
FLIP
\<< PICT PICT RCL NEG {#0 #0} SWAP REPL \>>
This version is also faster.
Preston
From jmunkki@kampi.hut.fi Mon Apr 9 18:10:54 1990
From: jmunkki@kampi.hut.fi (Juri Munkki)
Newsgroups: comp.sys.handhelds
Subject: Re: HP-48SX Program to Calculate/Show the Phase of the Moon
Date: 8 Apr 90 09:53:33 GMT
Reply-To: jmunkki@kampi.hut.fi (Juri Munkki)
Organization: Helsinki University of Technology, FINLAND
In <21580056@hpcvra.CV.HP.COM> prestonb@hpcvra.CV.HP.COM (Preston Brown):
>If you don't want to glitch the display then change FLIP to:
>
>FLIP
>\<< PICT PICT RCL NEG {#0 #0} SWAP REPL \>>
>
>This version is also faster.
What's wrong with just doing PICT NEG? Works fine and is visibly faster.
What would you call glitching the display?
___________________________________________________________________________
/ Juri Munkki / Helsinki University of Technology / Wind / HP S /
/ jmunkki@hut.fi / Computing Center Macintosh Support / Surf / 48 X /
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~